#include "gameloop.h"

int Level1_loop(){
	extern Game game;
	extern int last_sc;
	L1init();
	LIntro(&(game.level1));
	initializeMusic(game.level1.songNumber);	
	do{		
		GetInput();		
		if(!Update( &(game.level1) ))
			return 1;
		if(isAtFinish(game.hero , game.level1.finish))
			return 0;
		Draw(game.level1);			
		//mili_sleep(10);
	}while(last_sc != 1);
	return 0;
}

int Level2_loop(){
	extern Game game;
	extern int last_sc;
	L2init();
	LIntro(&(game.level2));
	initializeMusic(game.level2.songNumber);		
	do{		
		GetInput();		
		if(!Update( &(game.level2) ))
			return 1;
		if(isAtFinish(game.hero , game.level2.finish))
			return 0;
						
		Draw(game.level2);			
		//mili_sleep(10);
	}while(last_sc != 1);
	return 0;
}

int Level3_loop(){
	extern Game game;
	extern int last_sc;
	L3init();
	LIntro(&(game.level3));
	initializeMusic(game.level3.songNumber);
	do{		
		GetInput();		
		if(!Update( &(game.level3) ))
			return 1;
		if(isAtFinish(game.hero , game.level3.finish))
			return 0;
						
		Draw(game.level3);			
		//mili_sleep(10);
	}while(last_sc != 1);
	return 0;
}
